<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="../templates/ui.xhtml">

	<ui:define name="content">

		<h1 class="title ui-widget-header ui-corner-all">Captcha</h1>
		<div class="entry">
			<p>Captcha is based on reCAPTCHA API.</p>
			
			<h:form id="form">
				
                <p:messages showDetail="true"/>

                <p:captcha label="Captcha" />

				<br />
				
				<p:commandButton id="btn" value="Check" actionListener="#{captchaBean.submit}" ajax="false"/>
			</h:form>
			
			<h3>Source</h3>
			<p:tabView>
				<p:tab title="captcha.xhtml">
					<pre name="code" class="xml">
&lt;h:form&gt;
				
	&lt;p:messages showDetail="true"/&gt;

	&lt;p:captcha label="Captcha"/&gt;

	&lt;p:commandButton value="Check" ajax="false"
				actionListener="\#{captchaBean.submit}" /&gt;
&lt;/h:form&gt;
					</pre>
				</p:tab>
				
				<p:tab title="CaptchaBean.java">
					<pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class CaptchaBean {

	public void submit(ActionEvent event) {
		FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Correct", "Correct");
		
		FacesContext.getCurrentInstance().addMessage(null, msg);
	}
}
					</pre>
				</p:tab>
			</p:tabView>
			
		</div>

	</ui:define>
</ui:composition>
